package work;

import book.Book;
import book.Booklist;

public class AddBook implements Iwork{
    public void work(Booklist booklist)
    {
        if(booklist.getBooklistsize()<=9) {
            System.out.println("输入书籍名称");
            String bookname = scanner.next();
            System.out.println("输入书籍作者");
            String author = scanner.next();
            System.out.println("输入书籍价格");
            double price = (double) scanner.nextDouble();
            System.out.println("输入书籍类型");
            String type = scanner.next();
            int pos = booklist.getBooklistsize();
            booklist.setBook(new Book(bookname, author, price, type), pos);
            booklist.setBooklistsize(pos + 1);
        }else{
            System.out.println("书架已满");
        }


    }
}
